#ifndef CHAPTER13_H_
#define CHAPTER13_H_
#include <iostream>
class HasPtr {
public:
	HasPtr(const std::string &s = std::string()):
		ps(new std::string(s)), i(0){}

	HasPtr(const HasPtr &other):ps(new std::string(*other.ps)), i(other.i){}
	HasPtr &operator=(const HasPtr &rhs) {
		std::string *nps = new std::string(*rhs.ps);
		delete ps;
		ps = nps;
		i = rhs.i;
		return *this;
	}

	~HasPtr() {
		delete ps;
	}
private:
	std::string *ps;
	int i;
};
class numbered {

public:
	numbered() {
		count++;
		num = count;
	}
	numbered(const numbered &init) {
		num = ++count;
	}
	int num;
private:
	static int count;
};
int numbered::count = 0;

void f(numbered &s) { std::cout << s.num << std::endl; }

class Employee {
public:
	Employee():uid(++sid){}
	Employee(const Employee &cp):uid(++sid), name(cp.name){}
	Employee(std::string pName):uid(++sid), name(pName) {
	}

	Employee &operator=(const Employee &rhs) {
		uid = ++sid;
		name = rhs.name;
	}
private:
	std::string name;
	int uid;
	static int sid;
};
int Employee::sid = 0;

 
#endif